<?php

namespace app\backstage\validate;

use think\Validate;

class OpenValidate extends Validate
{
    protected $rule = [
        'id' => 'require|number|gt:0',
        'name' => 'require|max:20',
        'test_user_id' => 'number|gt:0',
        'user_grep' => 'require|number|in:0,1,2',
        'is_pay' => 'require|number|in:0,1,2',
        'mini_pay_money' => 'require|float|egt:0.1',
        'coin_balance' => 'require|number|in:1,2,3,4,5',
        'register_type' => 'require|number|in:0,1',
        'register_start' => 'number|gt:0',
        'register_end' => 'number|gt:0',
        'type' => 'require|number|in:1,2,3',
        'activity_id' => 'number|gt:0',
        'pic' => 'max:255',
        'table_novel_id' => 'array',
        'wgt' => 'require|number|egt:0',
        'quick_apps' => 'require|array',
        'status' => 'require|in:0,1',
        'jump_url' => 'max:255',
    ];

    protected $message = [
        'quick_apps' => '请选择App',
        'pic' => '请上传图片'
    ];

    protected $scene = [
        'addOpen' => ['name', 'quick_apps', 'test_user_id', 'user_grep', 'is_pay',
             'mini_pay_money', 'coin_balance', 'register_type', 'register_start', 'register_end', 'type', 'activity_id', 'jump_url', 'pic'],
        'editOpen' => ['id', 'name', 'quick_apps', 'test_user_id', 'user_grep', 'is_pay',
            'mini_pay_money', 'coin_balance', 'register_type', 'register_start', 'register_end', 'type', 'activity_id', 'jump_url', 'pic'],

        'setOpenWgt' => ['id', 'wgt'],
        'delOpen' => ['id'],
        'setOpenStatus' => ['id', 'status'],
    ];
}